package com.aliothservice.catfish.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	public static Integer daysBetween(Date left, Date right) {
		Calendar leftCalendar = Calendar.getInstance();
		Calendar rightCalendar = Calendar.getInstance();
		
		leftCalendar.clear();
		leftCalendar.setTime(left);
		rightCalendar.clear();
		rightCalendar.setTime(right);
		
		long diff = rightCalendar.getTimeInMillis() - leftCalendar.getTimeInMillis();
		float days = (float)diff/(24 * 60 * 60 * 1000);
		
		return Integer.valueOf((int)days + 1);
	}
}
